namespace Maple.Branch.AuditLogs.DomainTests
{
    using System;
    using EfCoreConfigurations;
    using TestBases;

    public abstract class AuditLogsDomainTestBase : AuditLogsTestBase<AuditLogsDomainTestModule>
    {
        protected virtual void UsingDbContext(Action<IAuditLogsDbContext> action)
        {
            using var dbContext = GetRequiredService<IAuditLogsDbContext>();

            action.Invoke(dbContext);
        }

        protected virtual T UsingDbContext<T>(Func<IAuditLogsDbContext, T> action)
        {
            using var dbContext = GetRequiredService<IAuditLogsDbContext>();

            return action.Invoke(dbContext);
        }
    }
}
